home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / MacWT 0.04 / turlsLibs / Failure.c < prev    next >
Encoding:
Text File  |  1994-10-31  |  923 b   |  46 lines  |  [TEXT/MMCC]

  1. //==================================================================
  2. // Failure.c                                        <tur 26-Feb-94>
  3. //
  4. // Simple Error reporting.
  5. //
  6. // Currently just Macsbugs, but you can override this with your own
  7. // procedure. In any event, we do an ExitToShell().
  8. //
  9. //==================================================================
  10.  
  11. #include    <stdio.h>
  12. #include    <stdarg.h>
  13. #ifndef    __QUICKDRAW__
  14. #include    <Types.h>
  15. #include    <SegLoad.h>
  16. #endif
  17. #include    "Failure.h"
  18.  
  19.  
  20. //==================================================================
  21.  
  22. ShowFailureProc    gShowFailProc;
  23.  
  24. //==================================================================
  25.  
  26.  
  27. // Simple-minded error reportage...
  28.  
  29. void Fail(const char *fmt, ...)
  30. {
  31.     va_list    args;
  32.     char    buf[256];
  33.  
  34.     va_start(args, fmt);
  35.     buf[0] = vsprintf(buf+1, fmt, args);
  36.     va_end(args);
  37.  
  38.     if (gShowFailProc)
  39.         gShowFailProc((StringPtr)buf);
  40.     else
  41.         DebugStr((StringPtr)buf);
  42.  
  43.     ExitToShell();
  44. }
  45.  
  46.